import pickle

class AntPickle:
    def __init__(self, chromosome, seed):    
        ''' Construct an object that can be pickled. It includes both the chromosome
        and the seed of the board it was evolved on.
        '''
        self.chromosome = chromosome
        self.seed = seed

def pickle_chromosome(chromosome, seed, file_name):
    ''' Pickles the given chromosome to the given file name.
    '''
    pickle.dump(AntPickle(chromosome, seed), open(file_name,"wb"))

def unpickle_chromosome(file_name):
    ''' Returns the chromosome that was pickeled to the given file name.
    '''
    antPickle = pickle.load(open(file_name,"rb"))
    return (antPickle.chromosome, antPickle.seed)